/*
 * @Author: zipeng 1134348223@qq.com
 * @Date: 2023-02-20 14:25:31
 * @LastEditors: zipeng 1134348223@qq.com
 * @LastEditTime: 2024-11-17 16:59:36
 * @FilePath: \mycode\Ringbuffer.h
 * @Description: 
 * 
 * Copyright (c) 2024 by HuaWeiTecho, All Rights Reserved. 
 */
#ifndef _RINGBUFFER_H_
#define _RINGBUFFER_H_
#include "stdint.h"

typedef struct {
    uint32_t capcity;
    int32_t write_index;
    int32_t read_index;
    uint8_t *ptrBuffer;
} ADPT_RingBufferStru;

int32_t RingBuffer_Init(ADPT_RingBufferStru *ptrRb, uint8_t *ptrBuf, uint32_t size);
int32_t RingBuffer_Write_One_Byte(ADPT_RingBufferStru *ptrRb, uint8_t dataIn);
int32_t RingBuffer_Write_Some_Byte(ADPT_RingBufferStru *ptrRb, uint8_t *ptrDataIn, uint32_t len);
int32_t RingBuffer_ReadOneByte(ADPT_RingBufferStru *ptrRb, uint8_t *dataOut);
int32_t RingBuffer_ReadSomeByte(ADPT_RingBufferStru *ptrRb, uint8_t *ptrDataOut, uint32_t len);
int32_t Is_RingBuffer_Full(ADPT_RingBufferStru *ptrRb);
int32_t Is_RingBuffer_Empty(ADPT_RingBufferStru *ptrRb);
int Get_RingBuffer_RemainSizes(ADPT_RingBufferStru *ptrRb);

#endif //
